<!--
 * @Author: ZCL
 * @Date: 2020-05-18 14:17:47
 * @LastEditors: ZCL
 * @LastEditTime: 2020-05-18 14:17:47
-->
<template>
  <!-- 耗材详情 -->
  <div class="assetDetail">
    <!-- 轮播图 组件 -->
    <Carousel :assetInfoList="assetInfoList" />

  </div>
</template>

<script>
import Carousel from '@/components/Carousel';

export default {
  name: 'AssetDetail',
  components: {
    Carousel
  },
  props: ['$type'],
  data () {
    return {
      assetInfoList: {} // 资产信息
    };
  },
  methods: {
    // 获取资产信息详情
    getAssetInfo () {
      let params = {
        id: this.$route.query.id
      };
      this.$api.getAssetInfo(params).then(res => {
        if (res.code === 0) {
          this.assetInfoList = res.result;
        }
      });
    },
    // 获取耗材详情
    getConsumableAssetInfo () {
      let params = {
        id: this.$route.query.id
      };
      this.$api.getConsumableInfo(params).then(res => {
        if (res.code === 0) {
          this.assetInfoList = res.result;
        }
      });
    }
  },
  created () {
    if (this.$type === this.$const.COMMON_TYPES.CONSUMABLE) {
      this.getConsumableAssetInfo();// 获取耗材详情
    } else {
      this.getAssetInfo();// 获取资产信息详情
    }
  }
};
</script>

<style lang="scss" scoped>
.assetDetail {
  // 操作记录
  ::v-deep.record-box {
    .record {
      padding-top: 20px !important;
    }
  }
}
</style>
